package Struct;

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        ArrayList<Integer> ids = new ArrayList<Integer>();

        int total = ids.size(); // total will be zero

        System.out.println("ArrayList size is  " + total);
        System.out.println("ArrayList elements are   " + ids);

        ids.add(new Integer(10)); // Adding an Integer object.
        ids.add(20); // Autoboxing
        ids.add(30); // Autoboxing

        total = ids.size(); // total will be 3

        System.out.println("ArrayList size is  " + total);
        System.out.println("ArrayList elements are   " + ids);

        ids.clear();

        total = ids.size(); // total will be 0
        System.out.println("ArrayList size is  " + total);
        System.out.println("ArrayList elements are   " + ids);

        /* ArrayList<Integer> nums = new ArrayList<>();
        Scanner scanner = new Scanner(System.in);
        nums.add(1);
        nums.add(2);
        nums.add(3);
        nums.add(4);
        nums.add(5);
        nums.add(6);
        nums.add(7);
        System.out.println(nums);//可以直接打印数组出来 Just Print Array
        for (int x: nums){
            System.out.print(x+" ");
        }*/
    }
}
